package Qc;

import marks.marksDriver;
import marks.marksMapper;
import marks.marksReducer;
import org.apache.hadoop.conf.Configuration;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.DoubleWritable;
import org.apache.hadoop.io.IntWritable;
import org.apache.hadoop.io.NullWritable;
import org.apache.hadoop.io.Text;
import org.apache.hadoop.mapreduce.Job;
import org.apache.hadoop.mapreduce.lib.input.FileInputFormat;
import org.apache.hadoop.mapreduce.lib.output.FileOutputFormat;

import java.io.IOException;

public class QcDricer {
    public static void main(String[] args) throws IOException, InterruptedException, ClassNotFoundException {
    Configuration conf = new Configuration();
    Job job = Job.getInstance(conf,"Qc");

    job.setJarByClass(QcDricer.class);
    job.setMapperClass(QcMapper.class);
    job.setReducerClass(QcReducer.class);

    job.setMapOutputKeyClass(Text.class);
    job.setMapOutputValueClass(NullWritable.class);

    job.setOutputKeyClass(Text.class);
    job.setOutputValueClass(NullWritable.class);

    Path input = new Path("inputdata4");
    Path output = new Path("outputdata4");

    FileSystem fs = FileSystem.get(conf);
    if (fs.exists(output))
    {
        fs.delete(output, true);
    }
    FileInputFormat.setInputPaths(job,input);
    FileOutputFormat.setOutputPath(job,output);

    boolean result = job.waitForCompletion(true);

    System.exit(result?0:1);
}
}
